package org.yjy.sys.controller.account;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.yjy.sys.dao.account.UsersDao;
import org.yjy.sys.service.account.UsersService;
import org.yjy.pvd.pojo.account.Users;

@RequestMapping("/User")
@CrossOrigin
@RestController
public class UsersController {

    @Autowired
    private UsersService usersService;
    @Autowired
    private UsersDao usersDao;

    @GetMapping("/sourceTests")
    public String sourceTestsUsers(){
        return usersService.findAll();
    }

    /**
     * 该方法做登录的支持
     * @return
     */
    @GetMapping("/selectByNameAndPassword")
    public Users selectUsersByNameAndPassword(Users user){
        return usersService.selectUsersByNameAndPassword(user);
    }
    @PostMapping("/selectByName")
    public Users selectUsersByName(@RequestBody Users user){
        return usersService.selectUsersByName(user);
    }

    /**
     * 注册请求
     * 1)接受校验UserRegistrtVo对象
     *  数据采用一次性录入,尽可能将用户提供的对象入库
     */
}
